package com.ourcraft.informationcollectionsystem.entity.DTO;

import com.alibaba.fastjson.annotation.JSONField;
import com.ourcraft.informationcollectionsystem.entity.DataReportForm;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
public class ReportDataContainer {
    @JSONField private String province;
    @JSONField private String investigation;
    @JSONField private Integer startTotalNum;
    @JSONField private Integer endTotalNum;
    @JSONField private Integer dataLength;
    @JSONField private List<DataReportForm> data;

    public ReportDataContainer(Date investigationStartDate, Integer investigationLength,
                               Integer startTotalNum, Integer endTotalNum,
                               List<DataReportForm> data){
        this.province = "云南";
        this.startTotalNum = startTotalNum;
        this.endTotalNum = endTotalNum;
        this.data = data;
        this.dataLength = data.size();

        var start = LocalDate.of(
                investigationStartDate.getYear() + 1900,
                investigationStartDate.getMonth() + 1,
                investigationStartDate.getDay() + 1
        );
        this.investigation = start + " - " + start.plusDays(investigationLength);
    }
}
